#pragma once

#include <vector>

#include <glad/gl-headers.h>
#include <vmath.h>

class MeshGrid
{
public:
    MeshGrid();
    MeshGrid(const MeshGrid &) = delete;
    MeshGrid &operator=(const MeshGrid &) = delete;
    ~MeshGrid();
public:
    void createMesh(GLfloat *vertices, unsigned int *indices, unsigned int numOfVertices,
                    unsigned int numOfIndices);
    void renderMesh();
    void clearMesh();
    void setUseGLPath(unsigned int glpath);

    vmath::vec3 getMinPosition()const;
    vmath::vec3 getMaxPosition()const;

    void makeTfbo();
    void enableFeedback();
    std::vector<vmath::vec4> getFeedbackOut();
private:
    GLuint vao, vbo, ibo;
    GLuint tfbo;
    GLsizei count;
    vmath::vec3 minPos, maxPos;
    unsigned int useGlpatch = 0;
    bool feedbackBool;
    std::vector<vmath::vec4> feedbackOut;
};
